package to.pm.entity.catalogo;


import java.util.List;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import to.pm.entity.magazzino.Stock;



@Entity 
public class ProdottoConsumabile extends Prodotto {

    @ManyToOne
    protected CategoriaConsumabili categoriaConsumabili;

    @OneToMany(mappedBy = "prodotto")
    private List<Stock> stocks;
    
    public void setCategoriaConsumabili (CategoriaConsumabili categoria) {
        this.categoriaConsumabili = categoria;
    }

    public CategoriaConsumabili getCategoriaConsumabili() {
        return categoriaConsumabili;
    }

    @Override
    public void setCategoria(Categoria categoria) {
        setCategoriaConsumabili((CategoriaConsumabili)categoria);
    }

    @Override
    public Categoria getCategoria () {
        return getCategoriaConsumabili();
    }


    @Override
    public boolean isConsumabile () {
        return true;
    }

    public List<Stock> getStocks() {
        return stocks;
    }

    public void setStocks(List<Stock> stocks) {
        this.stocks = stocks;
    }

    

    @Override
    public String toString () {
        return "{PC}"+super.toString();
    }
}
